package vn.com.aptech.msh.criteria;

import java.io.Serializable;
import vn.com.aptech.msh.entities.HouseType;

/**
 *
 * @author trietto
 */
public class SellingHouseCriteria implements Serializable {

    private String city = "";
    private String location = "";
    private double priceMin = 0;
    private double priceMax = 0;
    private double squareFootageMin = 0;
    private double squareFootageMax = 0;
    private int noBedroomsMin = 0;
    private int noBedroomsMax = 0;
    private int noBathroomsMin = 0;
    private int noBathroomsMax = 0;
    private HouseType houseType = null;

    public SellingHouseCriteria() {
    }

    public void finish() {
        if (city == null) city = "";
        if (location == null) location = "";
        city = "%" + city + "%";
        location = "%" + location + "%";
        if (priceMin == 0) {
            priceMin = -Double.MAX_VALUE;
        }
        if (priceMax == 0) {
            priceMax = Double.MAX_VALUE;
        }
        if (squareFootageMin == 0) {
            squareFootageMin = -Double.MAX_VALUE;
        }
        if (squareFootageMax == 0) {
            squareFootageMax = Double.MAX_VALUE;
        }

        if (noBedroomsMin == 0) {
            noBedroomsMin = Integer.MIN_VALUE;
        }
        if (noBedroomsMax == 0) {
            noBedroomsMax = Integer.MAX_VALUE;
        }
        if (noBathroomsMin == 0) {
            noBathroomsMin = Integer.MIN_VALUE;
        }
        if (noBathroomsMax == 0) {
            noBathroomsMax = Integer.MAX_VALUE;
        }
    }

    public String getCity() {
        return city;
    }

    public void setCity(String city) {
        this.city = city;
    }

    public HouseType getHouseType() {
        return houseType;
    }

    public void setHouseType(HouseType houseType) {
        this.houseType = houseType;
    }

    public String getLocation() {
        return location;
    }

    public void setLocation(String location) {
        this.location = location;
    }

    public int getNoBathroomsMax() {
        return noBathroomsMax;
    }

    public void setNoBathroomsMax(int noBathroomsMax) {
        this.noBathroomsMax = noBathroomsMax;
    }

    public int getNoBathroomsMin() {
        return noBathroomsMin;
    }

    public void setNoBathroomsMin(int noBathroomsMin) {
        this.noBathroomsMin = noBathroomsMin;
    }

    public int getNoBedroomsMax() {
        return noBedroomsMax;
    }

    public void setNoBedroomsMax(int noBedroomsMax) {
        this.noBedroomsMax = noBedroomsMax;
    }

    public int getNoBedroomsMin() {
        return noBedroomsMin;
    }

    public void setNoBedroomsMin(int noBedroomsMin) {
        this.noBedroomsMin = noBedroomsMin;
    }

    public double getPriceMax() {
        return priceMax;
    }

    public void setPriceMax(double priceMax) {
        this.priceMax = priceMax;
    }

    public double getPriceMin() {
        return priceMin;
    }

    public void setPriceMin(double priceMin) {
        this.priceMin = priceMin;
    }

    public double getSquareFootageMax() {
        return squareFootageMax;
    }

    public void setSquareFootageMax(double squareFootageMax) {
        this.squareFootageMax = squareFootageMax;
    }

    public double getSquareFootageMin() {
        return squareFootageMin;
    }

    public void setSquareFootageMin(double squareFootageMin) {
        this.squareFootageMin = squareFootageMin;
    }
}
